$(function(){
	var server = "https://cloud.kaaction.com";
	var host = server + "/crab/api/v1/";
	$.ajax({
		url:host + 'crabProductApi/getRecommendProduct',
		dataType:'json',
		success:function(res){
			console.log(res);
			resinfomation = res.data;
			$.each(resinfomation,function(key,value){
				var $alink  = $('<a>');
				$alink.attr('href',value['link']);
				var $div = $('<div>');
				var $divcrab = $('<div>');
				$alink.addClass('tocarb');
				$div.addClass('carb-content');
				$divcrab.addClass('carb-des');
				$alink.href = value['link'];
				$divcrab.append('<p>'+ value['name'] +'</p>')
						.append('<p>'+ value['male'] +'</p>')
						.append('<p>'+ value['female'] +'</p>')
				$div.append('<img src='+server + value['photo'] +'></img>')
					.append($divcrab)
					.appendTo($alink);
				$alink.appendTo('div.crablist');
			})
		}
	})
	// 跳转选择
	$('img.tohome').click(function(){
		window.location.href = 'index.html';
	})
	$('img.toresult').click(function(){
		window.location.href = 'result.html';
	})
})
